package demo8;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.sql.Connection;
import java.sql.SQLException;

public class Demo {
    public static void main(String[] args) throws SQLException {
        AnnotationConfigApplicationContext context
                = new AnnotationConfigApplicationContext(Config.class);
        Person p1 = context.getBean(Person.class);
        System.out.println(p1);
        Student s1 = context.getBean(Student.class);
        System.out.println(s1);

        DBUtil dbUtil = context.getBean(DBUtil.class);
        Connection conn = dbUtil.getConnection();
        System.out.println(conn);

    }
}
